<?php

class CCoupon{
	
	public function getDetail($where){
		
		$db=Zend_Registry::get('db');
		
		$select=$db->select();
		
		$select->from($this->_name,'coupon');
		
		$select->where($where);
		
		return $db->fetchOne($select);
		
	}
	
	public function addCoupon($coupon,$where){
		
		$db=Zend_Registry::get('db');
		
		return $db->query('UPDATE '.R_PRE.'members SET my_coupon=round(my_coupon+'.$coupon.',2) '.$where);
		
	}
	
	public function subCoupon($coupon,$where){
		
		$db=Zend_Registry::get('db');
		
		return $db->query('UPDATE '.R_PRE.'members SET my_coupon=round(my_coupon-'.$coupon.',2) '.$where);
		
	}

	
}